@*+:cnd:noEmit*@
@attribute [Route(PageUrls.SignUp)]
@attribute [Route("{culture?}" + PageUrls.SignUp)]
@inherits AppPageBase

<AppPageData Title="@Localizer[nameof(AppStrings.SignUp)]"
             PageTitle="@Localizer[nameof(AppStrings.SignUpPageTitle)]" />

<section>
    <BitStack HorizontalAlign="BitAlignment.Center">
        <BitStack HorizontalAlign="BitAlignment.Center" Class="max-width">
            <BitStack AutoHeight>
                <BitText Typography="BitTypography.H4">@Localizer[nameof(AppStrings.SignUpPanelTitle)]</BitText>

                <BitText Typography="BitTypography.Subtitle1" Color="BitColor.SecondaryForeground">
                    @Localizer[nameof(AppStrings.SignUpPanelSubtitle)]
                </BitText>
            </BitStack>

            <SocialRow IsWaiting="isWaiting" OnClick="SocialSignUp" />

            <BitSeparator Border="BitColorKind.Tertiary" Background="BitColorKind.Secondary" Class="lg-sep">@Localizer[AppStrings.Or]</BitSeparator>
            <BitSeparator Border="BitColorKind.Secondary" Background="BitColorKind.Primary" Class="sm-sep">@Localizer[AppStrings.Or]</BitSeparator>

            <EditForm Model="signUpModel" OnValidSubmit="WrapHandled(DoSignUp)" novalidate>
                <AppDataAnnotationsValidator />

                <BitStack FillContent Gap="2rem">
                    <BitStack FillContent>
                        <BitPivot Alignment="BitAlignment.Center">
                        @* <BitPivotItem HeaderText="@Localizer[nameof(AppStrings.UserName)]">
                            <BitTextField @bind-Value="signUpModel.UserName"
                                          TabIndex="1"
                                          Type="BitInputType.Text"
                                          Label="@Localizer[nameof(AppStrings.UserName)]"
                                          Placeholder="@Localizer[nameof(AppStrings.UserName)]" />
                            <ValidationMessage For="@(() => signUpModel.UserName)" />
                        </BitPivotItem> *@

                            <BitPivotItem HeaderText="@Localizer[nameof(AppStrings.Email)]">
                                <BitTextField @bind-Value="signUpModel.Email"
                                              TabIndex="1"
                                              Type="BitInputType.Email"
                                              Label="@Localizer[nameof(AppStrings.Email)]"
                                              Placeholder="@Localizer[nameof(AppStrings.EmailPlaceholder)]" />
                                <ValidationMessage For="@(() => signUpModel.Email)" />
                            </BitPivotItem>

                            <BitPivotItem HeaderText="@Localizer[nameof(AppStrings.Phone)]">
                                <BitTextField @bind-Value="signUpModel.PhoneNumber"
                                              AutoFocus TabIndex="1"
                                              Type="BitInputType.Tel"
                                              Label="@Localizer[nameof(AppStrings.PhoneNumber)]"
                                              Placeholder="@Localizer[nameof(AppStrings.PhoneNumberPlaceholder)]" />
                                <ValidationMessage For="@(() => signUpModel.PhoneNumber)" />
                            </BitPivotItem>
                        </BitPivot>

                        <BitTextField @bind-Value="signUpModel.Password" CanRevealPassword
                                      TabIndex="2"
                                      Type="BitInputType.Password"
                                      Label="@Localizer[nameof(AppStrings.Password)]"
                                      AutoComplete="@BitAutoCompleteValue.NewPassword"
                                      Placeholder="@Localizer[nameof(AppStrings.PasswordPlaceholder)]" />
                        <ValidationMessage For="@(() => signUpModel.Password)" />
                    </BitStack>

                @*#if (captcha == "reCaptcha")*@
                    <GoogleRecaptcha />
                @*#endif*@

                    <BitButton IsLoading="isWaiting" ButtonType="BitButtonType.Submit">
                        @Localizer[nameof(AppStrings.SignUp)]
                    </BitButton>
                </BitStack>
            </EditForm>
            <br />
            <BitText Typography="BitTypography.Body2">
                @Localizer[nameof(AppStrings.SignInMessageInSignUp)]
                <BitLink Href="@($"{PageUrls.SignIn}?return-url={Uri.EscapeDataString(ReturnUrlQueryString ?? PageUrls.Home)}")">@Localizer[nameof(AppStrings.SignIn)]</BitLink>
                @Localizer[nameof(AppStrings.Or)]
                <BitLink Href="@($"{PageUrls.Confirm}?email={Uri.EscapeDataString(signUpModel.Email ?? "")}&phoneNumber={Uri.EscapeDataString(signUpModel.PhoneNumber ?? "")}&return-url={Uri.EscapeDataString(ReturnUrlQueryString ?? PageUrls.Home)}")">
                    @Localizer[nameof(AppStrings.Confirm)]
                </BitLink>
            </BitText>
            <BitText Typography="BitTypography.Body2">
                By signing up, you agree to our <BitLink Href="@PageUrls.Terms">@Localizer[nameof(AppStrings.Terms)]</BitLink>
            </BitText>
        </BitStack>
    </BitStack>
</section>